#!/bin/bash

# 设置编译选项
CXX=g++
CXXFLAGS="-I../cbp2make/lib -I../cbp2make/src -Wall -std=c++11"

# 源文件列表
SOURCES="src/cbp2make.cpp \
         src/aicoder_enhancements.cpp \
         ../cbp2make/src/buildtools.cpp \
         ../cbp2make/src/cbbuildcfg.cpp \
         ../cbp2make/src/cbbuildmgr.cpp \
         ../cbp2make/src/cbglobalvar.cpp \
         ../cbp2make/src/cbhelper.cpp \
         ../cbp2make/src/cbproject.cpp \
         ../cbp2make/src/cbptarget.cpp \
         ../cbp2make/src/cbpunit.cpp \
         ../cbp2make/src/cbworkspace.cpp \
         ../cbp2make/src/depsearch.cpp \
         ../cbp2make/src/makefile.cpp \
         ../cbp2make/src/platforms.cpp \
         ../cbp2make/src/toolchains.cpp \
         ../cbp2make/lib/stlconfig.cpp \
         ../cbp2make/lib/stlconvert.cpp \
         ../cbp2make/lib/stlfutils.cpp \
         ../cbp2make/lib/stlgpm.cpp \
         ../cbp2make/lib/stlstrings.cpp \
         ../cbp2make/lib/stlvariables.cpp \
         ../cbp2make/lib/stringhash.cpp \
         ../cbp2make/lib/tinyxml/tinystr.cpp \
         ../cbp2make/lib/tinyxml/tinyxml.cpp \
         ../cbp2make/lib/tinyxml/tinyxmlerror.cpp \
         ../cbp2make/lib/tinyxml/tinyxmlparser.cpp"

# 编译命令
echo "编译 cbp2make_ai..."
$CXX $CXXFLAGS $SOURCES -o cbp2make_ai_test

if [ $? -eq 0 ]; then
    echo "✅ 编译成功!"
    rm -f cbp2make_ai_test
else
    echo "❌ 编译失败"
    exit 1
fi
